package com.nf.mapper;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

@Repository
public class DapMapperImp implements DaoMapper {

    @Autowired
    //因为在ioc中配置了ComboPooledDataSource的bean 所以可以直接注解
    private ComboPooledDataSource pool;

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public String getString() {
        return "ok";
    }

    @Override
    public void 数据库操作() {
        jdbcTemplate.update("insert into t1(id,name) VALUES (3,'999')");
    }
}
